home *** CD-ROM | disk | FTP | other *** search
- Components.utils.import("resource://samfind/rss/samfind_modrssutils.jsm");
-
- var EXPORTED_SYMBOLS = ["samfindRSSGetLink", "samfindRSSGetTitle", "samfindRSSGetDate", "samfindRSSGetImage", "samfindRSSGetContent"];
-
- function samfindRSSGetLink(websiteRssUrl, item)
- {
- if (websiteRssUrl == "http://www.oneriot.com/rss/trendingtopics")
- {
- var title = (item.getElementsByTagName("title"))[0];
- if (title)
- {
- return "javascript:samfind_rss._search('" + title.textContent + "');";
- }
- }
- else if (websiteRssUrl.indexOf("twitter.com") != -1)
- {
- var title = (item.getElementsByTagName("title"))[0];
- if (title)
- {
- title = title.textContent;
- var arr = /(\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/i.exec(title);
- if (arr)
- {
- return "javascript:samfind_rss.goTo('" + arr[1] + "');";
- }
- }
- }
- return null;
- }
-
- function samfindRSSGetTitle(websiteRssUrl, item)
- {
- if (websiteRssUrl.indexOf("twitter.com") != -1)
- {
- var title = (item.getElementsByTagName("title"))[0];
- if (title)
- {
- response = title.textContent;
- var start = response.indexOf(":");
- if (start != -1)
- {
- var end = response.indexOf("http://bit.ly", start);
- if (end == -1)
- {
- end = response.length;
- }
- return response.substring(start + 1, end);
- }
- }
- }
- return null;
- }
-
- function samfindRSSGetDate(websiteRssUrl, item)
- {
- if (websiteRssUrl == "http://www.oneriot.com/rss/trendingtopics")
- {
- return
- }
- return null;
- }
-
- function samfindRSSGetImage(websiteRssUrl, item)
- {
- return null;
- }
-
- function samfindRSSGetContent(websiteRssUrl, item, title, link)
- {
- if (websiteRssUrl.indexOf("twitter.com") != -1)
- {
- return " ";
- }
- var content = (item.getElementsByTagNameNS("http://purl.org/rss/1.0/modules/content/", "encoded"))[0];
- if (!content)
- {
- return null;
- }
- var response = content.textContent;
- response = response.replace(/&(lt|gt);/g, function(strMatch, p1){return (p1 == "lt") ? "<" : ">";});
- if (websiteRssUrl != "http://www.oneriot.com/rss/trendingtopics")
- {
- response = response.replace('<table', '<table class="search"');
- }
- response = response.replace(' width="45%"', "");
- response = response.replace(' width="80%"', "");
- response = response.replace(' width="30%"', "");
- response = response.replace(' cellspaing="10"', ' cellspacing="5"');
- response = response.replace("<br/>on", " on");
- response = response.replace("</td></td>", "</td>");
- response = response.replace("this.src='/", "this.src=");
- response = samfind_modrssutils.HTML2Unicode(response);
- response = response.replace("&", "&", "g");
- return response;
- }